package com.blog.backend.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;

/**
 * @author Auman
 * @time 2024/4/28 10:28
 */
@Data
@ApiModel("博客表实体类")
@Document(indexName = "blog_info",createIndex = true)
@TableName("blog_info")
public class BlogInfo {

    @Id
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "博客ID，主键，自增")
    private Integer id;

    @Field
    @TableField("title")
    @ApiModelProperty(value = "博客标题", required = true)
    private String title;

    @Field
    @TableField("content")
    @ApiModelProperty(value = "博客内容", required = true)
    private String content;

    @Field
    @TableField("code")
    @ApiModelProperty(value = "博客序号", required = false)
    private String code;

    @Field
    @TableField("belong_code")
    @ApiModelProperty(value = "所属用户编号", required = true)
    private String belongCode;

    @Field
    @TableField("author")
    @ApiModelProperty(value = "博客作者", required = true)
    private String author;

    @Field
    @TableField("category")
    @ApiModelProperty(value = "博客分类")
    private String[] category;

    @Field
    @TableField("tags")
    @ApiModelProperty(value = "博客标签，多个标签用逗号分隔")
    private String[] tags;

    @Field
    @TableField("status")
    @ApiModelProperty(value = "博客状态（草稿、已发布、回收站、彻底删除）")
    private String status;    //0'draft', 1'published', 2'recycle', 3'deleted'   默认0已发布

    @Field
    @TableField("created_time")
    @ApiModelProperty(value = "创建时间")
    private String createdTime;

    @Field
    @TableField("updated_time")
    @ApiModelProperty(value = "更新时间")
    private String updatedTime;
}
